package com.xmut.mall.order.controller;

import java.util.Arrays;
import java.util.Map;

import com.xmut.mall.order.annotation.CheckJwt;
import com.xmut.mall.order.utils.RespBean;
import com.xmut.mall.order.vo.PayVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.xmut.mall.order.entity.TradeEntity;
import com.xmut.mall.order.service.TradeService;
import com.xmut.mall.order.utils.PageUtils;
import com.xmut.mall.order.utils.R;



/**
 * 
 *
 * @author 1912120131suntingxing
 * @email 1192081604@qq.com
 * @date 2023-02-05 11:56:54
 */
@RestController
@RequestMapping("order/trade")
public class TradeController {
    @Autowired
    private TradeService tradeService;

    /**
     * 根据订单sn获取该订单的交易sn
     * @param sn
     * @return
     */
    @CheckJwt
    @GetMapping("/getTradeSnByOrderSn/{sn}")
    public RespBean getTradeSnByOrderSn(@PathVariable String sn){
        return tradeService.getTradeSnByOrderSn(sn);
    }

    /**
     * 获取支付相关交易参数
     * @param vo
     * @return
     */
    @CheckJwt
    @PostMapping("/tradeDetail")
    public RespBean tradeDetail(@RequestBody PayVo vo){
        return tradeService.tradeDetail(vo);
    }

}
